package hos.demo;

import android.app.Application;

import hos.constants.Api;
import hos.http.Http;
import hos.mock.MockDispatcher;
import hos.okhttp.convert.HttpResponseJsonDataMapListConverter;
import hos.okhttp.http.OkHttpFactory;
import hos.service.MockService;


/**
 * <p>Title: App </p>
 * <p>Description:  </p>
 * <p>Company: www.mapuni.com </p>
 *
 * @author : 蔡俊峰
 * @version : 1.0
 * @date : 2023/3/1 20:48
 */
public class App extends Application {

    static App app;

    public static App getApp() {
        return app;
    }

    public static MockService mock() {
        return app.mock;
    }

    private final MockService mock = Http.create(MockService.class);

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
        Http.config().init(this, Api.getMockUrl(), new OkHttpFactory(), new HttpResponseJsonDataMapListConverter());
        MockDispatcher.initialize();
    }
}
